<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%-- @author: Christian Baumhof --%>

<%-- Title --%>
<h1>
	<s:text name="title.history" />
</h1>

<%-- Student information --%>
<h2>
	<s:property value="selectedStudent.firstName" />
	<s:property value="selectedStudent.lastName" />
</h2>

<%-- Maniple and matnr. --%>
<table class="formTable">
	<tr>
		<td><s:text name="lbl.matrNr" /></td>
		<td><s:property value="selectedStudent.matriculationNr" /></td>
		<td><s:text name="lbl.maniple" /></td>
		<td><s:property value="selectedStudent.maniple.name" /></td>
	</tr>
</table>

<%-- Subject selection --%>
<s:form action="ShowHistory">
	<s:hidden id="id" key="id" />
	<table class="formTable">
		<tr>
			<td><s:select theme="simple" name="selectedSubjectId"
					list="subjects" listKey="id" listValue="title+' - '+description"
					value="selectedSubjectId" /></td>
			<td><s:submit theme="simple" key="button.show" /></td>
		</tr>
	</table>
</s:form>

<%-- Data table --%>
<table>
	<%-- Column headlines --%>
	<tr>
		<th><s:text name="lbl.entryDate" /></th>
		<th><s:text name="lbl.typist" /></th>
		<th><s:text name="lbl.grade" /></th>
		<th><s:text name="lbl.examDate" /></th>
		<th><s:text name="lbl.lecturer" /></th>
		<th><s:text name="lbl.oralExamDate" /></th>
		<th><s:text name="lbl.oralGrade" /></th>
		<th><s:text name="lbl.valid" /></th>
	</tr>

	<%-- Results --%>
	<s:iterator value="results" status="nrResult">
		<tr>
			<td><s:property value="entryDate" /></td>
			<td><s:property value="typist" /></td>
			<td><s:property value="grade" /></td>
			<td><s:property value="examination.date" /></td>
			<td><s:property value="examination.lecturer" /></td>
			<s:if test="hasOralExam[#nrResult.index]">
				<s:iterator value="oralExaminationResults">
					<s:if test="valid">
						<td><s:property value="date" /></td>
						<td><s:property value="grade" /></td>
					</s:if>
				</s:iterator>
			</s:if>
			<s:else>
				<td>-</td>
				<td>-</td>
			</s:else>
			<td><s:checkbox key="valid" theme="simple" disabled="true" /></td>
		</tr>
	</s:iterator>
</table>

<%-- Back button --%>
<s:form>
	<s:submit theme="simple" key="button.back" action="ShowGradeOverview" />
</s:form>
